using System.Windows.Input;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;

namespace Northwind.ViewModel
{
    public class ToolViewModel : ViewModelBase
    {
        private readonly IToolManager _toolManager;
        public string DisplayName { get; set; }

        private ICommand _closeCommand = null;

        public ICommand CloseCommand
        {
            get
            {
                return _closeCommand ??
                       (_closeCommand =
                        new RelayCommand(Close));
            }
        }

        public ToolViewModel(IToolManager toolManager)
        {
            _toolManager = toolManager;
        }

        protected void Close()
        {
            _toolManager.CloseTool(this);
        }
    }
}